package hh.leecode.binarytree;

public class TreeNode {
   public Object val;
   public TreeNode left;
   public TreeNode right;

    public TreeNode(Object val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }

    @Override
    public String toString() {
        return val+"";
    }

    /**
     *       5
     *   2        8
     * 1   3    6       20
     *  1.5            10
     */
    public static TreeNode createDefaultTree(int eleCount) {
        TreeNode root = new TreeNode(5, null, null);
        root.left = new TreeNode(2, null, null);
        root.right = new TreeNode(8, null, null);

        root.left.left = new TreeNode(1, null, new TreeNode(1.5,null,null));
        root.left.right = new TreeNode(3, null, null);


        root.right.left = new TreeNode(6, null, null);
        root.right.right = new TreeNode(20, null, null);

        root.right.right.left = new TreeNode(10, null, null);

        return root;
    }
}
